<?php

use Illuminate\Http\Request;
use Illuminate\Routing\Router;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group([
    'namespace' => 'API',
    'middleware' => 'cors'
], function(Router $router) {
    $router->post('user-login', 'Auth\\LoginController@login');
    $router->get('upload-token', 'UploadController@token');
    $router->group([
        'middleware' => 'auth:api',
    ], function (Router $router) {
        $router->get('index-top-all', 'OrderController@indexTopAll');
        $router->get('index-bottom-all', 'OrderController@indexBottomAll');
        $router->get('order-create-info', 'OrderController@createInfo');
        $router->get('component-maintenance', 'OrderController@componentMaintenance');
        $router->post('order-create', 'OrderController@create');
        $router->post('order-update', 'OrderController@update');
        $router->get('order-all', 'OrderController@orderAll');
        $router->get('order-get-list', 'OrderController@getList');
        $router->get('order-detail', 'OrderController@detail');
        $router->post('order-move-back', 'OrderController@moveBack');
        $router->post('assign', 'OrderController@assign');
        $router->get('processes-archives-all', 'OrderController@processesArchivesAll');
        $router->get('rework-all', 'OrderController@reworkAll');
        $router->get('stop-all', 'OrderController@stopAll');
        $router->get('technician-all', 'OrderController@technicianAll');
        $router->post('order-assign', 'OrderController@assign');
        $router->post('order-stop', 'OrderController@stop');
        $router->post('order-stop-continue', 'OrderController@stopContinue');
        $router->get('order-processes-archives-all', 'OrderController@orderProcessesArchivesAll');
        $router->post('rework', 'OrderController@rework');
        $router->post('settlement', 'OrderController@settlement');
        $router->get('work-log-all', 'OrderController@workLogAll');
        $router->get('operation-log-all', 'OrderController@operationLogAll');
        $router->get('photo-log-all', 'OrderController@photoLogAll');
        $router->get('rework-stop-log-all', 'OrderController@reworkStopLogAll');
        $router->post('order-photo-save', 'OrderController@photoSave');
        $router->post('order-photo-delete', 'OrderController@photoDelete');
        $router->get('user-info', 'UserController@userInfo');
        $router->post('user-logout', 'Auth\\LoginController@logout');
        $router->get('technician-data', 'OrderController@technicianData');
        $router->get('technician-list', 'OrderController@technicianList');
        $router->get('consultant-list', 'OrderController@consultantList');
        $router->get('consultant-data', 'OrderController@consultantData');
    });
});


